#define _CRT_SECURE_NO_WARNINGS
#include"array.h"


class Solution {
public:
    int removeDuplicates(vector<int>& nums)
    {
        int prev = 0;
        int cur = 1;
        while (cur < nums.size())
        {
            if (nums[cur] == nums[prev])
            {
                cur++;
            }
            else
            {
                nums[++prev] = nums[cur++];
            }
        }
        return prev + 1;
    }
};